//
//  DeviceUtils.m
//  MobileBank
//
//  Created by Mickey Yin on 2021/12/23.
//

#import "DeviceUtils.h"
#import "KeyChainStore.h"

@implementation DeviceUtils

+ (NSString*)getUUID {
    
    NSString *strUUID = (NSString*)[KeyChainStore load:KEY_USERNAME_PASSWORD];
    
    //首次执行该方法时，uuid为空
    if([strUUID isEqualToString:@""]|| !strUUID) {
        //生成一个uuid的方法
        CFUUIDRef uuidRef=CFUUIDCreate(kCFAllocatorDefault);
        strUUID = (NSString*)CFBridgingRelease(CFUUIDCreateString(kCFAllocatorDefault,uuidRef));

        //将该uuid保存到keychain
        [KeyChainStore save:KEY_USERNAME_PASSWORD data:strUUID];
    }
    return strUUID;
}


@end
